gtkimcontextime.c: Fix Korean input
authorChun-wei Fan <fanc999@yahoo.com.tw>
Tue, 9 Oct 2018 09:06:39 +0000 (17:06 +0800)
committerChun-wei Fan <fanc999@yahoo.com.tw>
Tue, 9 Oct 2018 09:10:23 +0000 (17:10 +0800)
commit1ca5b415711111cc037dff9a52d10d632137a3cb
tree02a5bea039b0ca00efcf848c44fd0c5141288df2
parentcebf5ed46cc326fd4eacfc434e83d1b581cff1f9
gtkimcontextime.c: Fix Korean input

Commit 64a489ad inadvertently introduced a regression that broke Korean
text input because the changes there resulted that only the last input
string that we have from ImmGetCompositionStringW() for each time the
commit signal is emitted is kept, and also as a result the final Korean
character that is input by hitting space is also lost as a result, as we
didn't check for whether we are done with preediting.

Fix these issues by doing the following when we receive the
WM_IME_COMPOSITION message with GCS_RESULTSTR from Windows:
-Do not emit the commit signal during WM_IME_ENDCOMPOSITION, and...
-Emit the commit signal anyways, as we did before c255ba68, however...
-We still save up the string to commit, because we need to re-compute
 the cursor position when we do ->get_preedit_string(), which needs to
 take the GCS_RESULTSTR string we get from WM_IME_COMPOSITION into
 account as well, so that we avoid getting the Pango criticals that
 occur during Chinese (and most likely Japanese) input as the cursor
 position is out-of-range.

Fixes issue #1350.
gtk/gtkimcontextime.c